/* unit test
 */

#include <stdint.h>
#include <stdio.h>

/*
 * 0 0 0 0 0 0 0 1 | 0 0 0 0 0 0 1 0
 *
 * 2_0 = 1, 2_1 = 2, 2_2 = 4, 2_3 = 8, 2_4 = 16, 2_5 = 32, 2_6 = 64, 2_7 = 128,
 * 2_8 = 256
 */
void test_big_little_endian() {
    short x = 0x0502;
    char *p = (char *)&x;
    printf("x = %d\n", x);
    printf("x size = %d\n", sizeof(x));
    printf("x1 = %d\n", *p);
    printf("x2 = %d\n", *(p + 1));

    printf("xp1 = %p\n", &x);
    printf("xp2 = %p\n", (&x) + 1);
    printf("cp  = %p\n", p);
}

int main(int argc, char const *argv[]) {
    test_big_little_endian();
    return 0;
}
